import { createApp } from 'vue'
import ElementPlus from 'element-plus'

import App from './App.vue'
import router from './router'
import pinia from './store'
import './styles/tree-theme.scss' // 自定义树木主题样式
import { userLoginStore } from './store/login/login'
// import { initBMapGLApiLoader } from 'vue-bmap-gl'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)

import baiduMap from 'vue3-baidu-map-gl'
app.use(baiduMap, {
  ak: 'wxUKx8Za2b6UrzDNTGVp8vYRRvvLHqLO',
  plugins: ['TrackAnimation'],
})

app.use(ElementPlus)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(pinia)

const loginStore = userLoginStore()
loginStore.loadLocalCacheAction(router)

app.use(router)
app.mount('#app')
